<template>
<div class="content">
    <mt-header fixed title="站点管理">
    <mt-button icon="back" @click.native="goback()" slot="left">返回</mt-button>
    <mt-button slot="right" @click.native="correcting()" type='default'>校正</mt-button>
    </mt-header>
    <mt-cell title="站点名称" :value="result.sitename" v-show="result.sitename"></mt-cell>
    <mt-cell title="建筑名称" :value="result.buidname" v-show="result.buidname"></mt-cell>
    <mt-cell title="监管单位名称" :value="result.Suervisorname" v-show="result.Suervisorname"></mt-cell>
    <mt-cell title="维保单位名称" :value="result.maintainname" v-show="result.maintainname"></mt-cell>
    <mt-cell title="业主名称" :value="result.Proprietorname" v-show="result.Proprietorname"></mt-cell>
    <mt-cell title="业主电话" :value="result.phone" v-show="result.phone"></mt-cell>
    <mt-cell title="详细地址" :value="result.address" v-show="result.address"></mt-cell>
    <mt-cell title="经度" :value="result.longitude" v-show="result.longitude"></mt-cell>
     <mt-cell title="纬度" :value="result.latitude" v-show="result.latitude"></mt-cell>
    <mt-cell title="高度" :value="result.levation" v-show="result.levation"></mt-cell>
    <div v-show="result.siteimageurl" class="image">
      <p>站点图片</p>
      <img :src="result.siteimageurl"/>
    </div>
     <div v-show="result.buildimageurl" class="image">
      <p>建筑屋照片</p>
      <img :src="result.buildimageurl"/>
    </div>
    </div>
</template>
<script>
export default {
  data () {
    return {
      result: {}
    }
  },
  created () {
    this.getdevicedetail()
  },
  components: {
  },
  computed: {
    siteid () {
      return this.$store.state.user.sitelist[0].siteid
    }
  },
  methods: {
    goback () {
      this.$router.go(-1)
    },
    correcting () {
      const query = {
        name: this.result.buidname,
        address: this.result.address,
        imgsrc: this.result.buildimageurl,
        buildid: this.result.buildid,
        lat: this.result.latitude,
        long: this.result.longitude,
        levation: this.result.levation
      }
      this.$router.push({
        path: '/correcting',
        query
      })
    },
    async getdevicedetail () {
      const res = await this.$store.dispatch('sitedetail', {
        siteid: this.siteid
      })
      if (res.status === '0') {
        this.result = res.context
      }
    }

  }
}
</script>
<style lang="less" scoped>
.content{
  padding-top: 40px;
}
.image{
  padding: 0 10px;
  border-top: 1px solid #eeeeee;
  p{
    text-align: left;
    line-height: 48px;
    font-size: 16px;
  }
  img{
    width: 100%
  }
}
</style>
